<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 702
</span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if __GLASGOW_HASKELL__ &gt;= 706
</span><span class="hs-pragma">{-# LANGUAGE PolyKinds #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if __GLASGOW_HASKELL__ &gt;= 710
</span><span class="hs-pragma">{-# LANGUAGE AutoDeriveTypeable #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Module      :  Control.Monad.Trans.Select</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Copyright   :  (c) Ross Paterson 2017</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- License     :  BSD-style (see the file LICENSE)</span><span>
</span><span id="line-16"></span><span class="hs-comment">--</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Maintainer  :  R.Paterson@city.ac.uk</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-20"></span><span class="hs-comment">--</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- Selection monad transformer, modelling search algorithms.</span><span>
</span><span id="line-22"></span><span class="hs-comment">--</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- * Martin Escardo and Paulo Oliva.</span><span>
</span><span id="line-24"></span><span class="hs-comment">--   &quot;Selection functions, bar recursion and backward induction&quot;,</span><span>
</span><span id="line-25"></span><span class="hs-comment">--   /Mathematical Structures in Computer Science/ 20:2 (2010), pp. 127-168.</span><span>
</span><span id="line-26"></span><span class="hs-comment">--   &lt;https://www.cs.bham.ac.uk/~mhe/papers/selection-escardo-oliva.pdf&gt;</span><span>
</span><span id="line-27"></span><span class="hs-comment">--</span><span>
</span><span id="line-28"></span><span class="hs-comment">-- * Jules Hedges. &quot;Monad transformers for backtracking search&quot;.</span><span>
</span><span id="line-29"></span><span class="hs-comment">--   In /Proceedings of MSFP 2014/. &lt;https://arxiv.org/abs/1406.2058&gt;</span><span>
</span><span id="line-30"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Control.Monad.Trans.Select</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The Select monad</span></span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#Select"><span class="hs-identifier">Select</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#select"><span class="hs-identifier">select</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#runSelect"><span class="hs-identifier">runSelect</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#mapSelect"><span class="hs-identifier">mapSelect</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The SelectT monad transformer</span></span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier">SelectT</span></a></span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier">SelectT</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#runSelectT"><span class="hs-identifier">runSelectT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#mapSelectT"><span class="hs-identifier">mapSelectT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Monad transformation</span></span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#selectToContT"><span class="hs-identifier">selectToContT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#selectToCont"><span class="hs-identifier">selectToCont</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#"><span class="hs-identifier">Control.Monad.IO.Class</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html"><span class="hs-identifier">Control.Monad.Trans.Class</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Cont.html"><span class="hs-identifier">Control.Monad.Trans.Cont</span></a></span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#"><span class="hs-identifier">Control.Monad.Fail</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Fail</span></span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#"><span class="hs-identifier">Data.Functor.Identity</span></a></span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span class="hs-comment">-- | Selection monad.</span><span>
</span><span id="line-59"></span><span class="hs-keyword">type</span><span> </span><span id="Select"><span class="annot"><a href="Control.Monad.Trans.Select.html#Select"><span class="hs-identifier hs-var">Select</span></a></span></span><span> </span><span id="local-6989586621679080796"><span class="annot"><a href="#local-6989586621679080796"><span class="hs-identifier hs-type">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080796"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-type">Identity</span></a></span><span>
</span><span id="line-60"></span><span>
</span><span id="line-61"></span><span class="hs-comment">-- | Constructor for computations in the selection monad.</span><span>
</span><span id="line-62"></span><span id="local-6989586621679080959"><span id="local-6989586621679080960"><span class="annot"><a href="Control.Monad.Trans.Select.html#select"><span class="hs-identifier hs-type">select</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679080960"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080959"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080960"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#Select"><span class="hs-identifier hs-type">Select</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080959"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080960"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-63"></span><span id="select"><span class="annot"><span class="annottext">select :: forall a r. ((a -&gt; r) -&gt; a) -&gt; Select r a
</span><a href="Control.Monad.Trans.Select.html#select"><span class="hs-identifier hs-var hs-var">select</span></a></span></span><span> </span><span id="local-6989586621679080795"><span class="annot"><span class="annottext">(a -&gt; r) -&gt; a
</span><a href="#local-6989586621679080795"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a -&gt; Identity r) -&gt; Identity a) -&gt; SelectT r Identity a
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="annot"><span class="annottext">(((a -&gt; Identity r) -&gt; Identity a) -&gt; SelectT r Identity a)
-&gt; ((a -&gt; Identity r) -&gt; Identity a) -&gt; SelectT r Identity a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679080794"><span class="annot"><span class="annottext">a -&gt; Identity r
</span><a href="#local-6989586621679080794"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; Identity a
forall a. a -&gt; Identity a
</span><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-var">Identity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; r) -&gt; a
</span><a href="#local-6989586621679080795"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Identity r -&gt; r
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span> </span><span class="annot"><span class="annottext">(Identity r -&gt; r) -&gt; (a -&gt; Identity r) -&gt; a -&gt; r
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Identity r
</span><a href="#local-6989586621679080794"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#select"><span class="hs-pragma hs-type">select</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span class="hs-comment">-- | Runs a @Select@ computation with a function for evaluating answers</span><span>
</span><span id="line-67"></span><span class="hs-comment">-- to select a particular answer.  (The inverse of 'select'.)</span><span>
</span><span id="line-68"></span><span id="local-6989586621679080942"><span id="local-6989586621679080943"><span class="annot"><a href="Control.Monad.Trans.Select.html#runSelect"><span class="hs-identifier hs-type">runSelect</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#Select"><span class="hs-identifier hs-type">Select</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080943"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080942"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679080942"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080943"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080942"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-69"></span><span id="runSelect"><span class="annot"><span class="annottext">runSelect :: forall r a. Select r a -&gt; (a -&gt; r) -&gt; a
</span><a href="Control.Monad.Trans.Select.html#runSelect"><span class="hs-identifier hs-var hs-var">runSelect</span></a></span></span><span> </span><span id="local-6989586621679080790"><span class="annot"><span class="annottext">Select r a
</span><a href="#local-6989586621679080790"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679080789"><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621679080789"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Identity a -&gt; a
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Select r a -&gt; (a -&gt; Identity r) -&gt; Identity a
forall r (m :: * -&gt; *) a. SelectT r m a -&gt; (a -&gt; m r) -&gt; m a
</span><a href="Control.Monad.Trans.Select.html#runSelectT"><span class="hs-identifier hs-var">runSelectT</span></a></span><span> </span><span class="annot"><span class="annottext">Select r a
</span><a href="#local-6989586621679080790"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">r -&gt; Identity r
forall a. a -&gt; Identity a
</span><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-var">Identity</span></a></span><span> </span><span class="annot"><span class="annottext">(r -&gt; Identity r) -&gt; (a -&gt; r) -&gt; a -&gt; Identity r
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621679080789"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#runSelect"><span class="hs-pragma hs-type">runSelect</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-comment">-- | Apply a function to transform the result of a selection computation.</span><span>
</span><span id="line-73"></span><span class="hs-comment">--</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- * @'runSelect' ('mapSelect' f m) = f . 'runSelect' m@</span><span>
</span><span id="line-75"></span><span id="local-6989586621679080935"><span id="local-6989586621679080936"><span class="annot"><a href="Control.Monad.Trans.Select.html#mapSelect"><span class="hs-identifier hs-type">mapSelect</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679080936"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080936"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#Select"><span class="hs-identifier hs-type">Select</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080935"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080936"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#Select"><span class="hs-identifier hs-type">Select</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080935"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080936"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-76"></span><span id="mapSelect"><span class="annot"><span class="annottext">mapSelect :: forall a r. (a -&gt; a) -&gt; Select r a -&gt; Select r a
</span><a href="Control.Monad.Trans.Select.html#mapSelect"><span class="hs-identifier hs-var hs-var">mapSelect</span></a></span></span><span> </span><span id="local-6989586621679080788"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679080788"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Identity a -&gt; Identity a)
-&gt; SelectT r Identity a -&gt; SelectT r Identity a
forall (m :: * -&gt; *) a r.
(m a -&gt; m a) -&gt; SelectT r m a -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#mapSelectT"><span class="hs-identifier hs-var">mapSelectT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Identity a
forall a. a -&gt; Identity a
</span><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-var">Identity</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Identity a) -&gt; (Identity a -&gt; a) -&gt; Identity a -&gt; Identity a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679080788"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; (Identity a -&gt; a) -&gt; Identity a -&gt; a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Identity a -&gt; a
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-77"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#mapSelect"><span class="hs-pragma hs-type">mapSelect</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span class="hs-comment">-- | Selection monad transformer.</span><span>
</span><span id="line-80"></span><span class="hs-comment">--</span><span>
</span><span id="line-81"></span><span class="hs-comment">-- 'SelectT' is not a functor on the category of monads, and many operations</span><span>
</span><span id="line-82"></span><span class="hs-comment">-- cannot be lifted through it.</span><span>
</span><span id="line-83"></span><span class="hs-keyword">newtype</span><span> </span><span id="SelectT"><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span></span><span> </span><span id="local-6989586621679080952"><span class="annot"><a href="#local-6989586621679080952"><span class="hs-identifier hs-type">r</span></a></span></span><span> </span><span id="local-6989586621679080953"><span class="annot"><a href="#local-6989586621679080953"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679080954"><span class="annot"><a href="#local-6989586621679080954"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="SelectT"><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679080954"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080953"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080952"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080953"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080954"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span class="hs-comment">-- | Runs a @SelectT@ computation with a function for evaluating answers</span><span>
</span><span id="line-86"></span><span class="hs-comment">-- to select a particular answer.  (The inverse of 'select'.)</span><span>
</span><span id="line-87"></span><span id="local-6989586621679080937"><span id="local-6989586621679080938"><span id="local-6989586621679080939"><span class="annot"><a href="Control.Monad.Trans.Select.html#runSelectT"><span class="hs-identifier hs-type">runSelectT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080939"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080938"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080937"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679080937"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080938"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080939"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080938"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080937"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-88"></span><span id="runSelectT"><span class="annot"><span class="annottext">runSelectT :: forall r (m :: * -&gt; *) a. SelectT r m a -&gt; (a -&gt; m r) -&gt; m a
</span><a href="Control.Monad.Trans.Select.html#runSelectT"><span class="hs-identifier hs-var hs-var">runSelectT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080787"><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080787"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080787"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-89"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#runSelectT"><span class="hs-pragma hs-type">runSelectT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="hs-comment">-- | Apply a function to transform the result of a selection computation.</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- This has a more restricted type than the @map@ operations for other</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- monad transformers, because 'SelectT' does not define a functor in</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- the category of monads.</span><span>
</span><span id="line-95"></span><span class="hs-comment">--</span><span>
</span><span id="line-96"></span><span class="hs-comment">-- * @'runSelectT' ('mapSelectT' f m) = f . 'runSelectT' m@</span><span>
</span><span id="line-97"></span><span id="local-6989586621679080930"><span id="local-6989586621679080931"><span id="local-6989586621679080932"><span class="annot"><a href="Control.Monad.Trans.Select.html#mapSelectT"><span class="hs-identifier hs-type">mapSelectT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679080932"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080931"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679080932"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080931"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080930"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080932"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080931"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080930"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080932"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080931"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-98"></span><span id="mapSelectT"><span class="annot"><span class="annottext">mapSelectT :: forall (m :: * -&gt; *) a r.
(m a -&gt; m a) -&gt; SelectT r m a -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#mapSelectT"><span class="hs-identifier hs-var hs-var">mapSelectT</span></a></span></span><span> </span><span id="local-6989586621679080786"><span class="annot"><span class="annottext">m a -&gt; m a
</span><a href="#local-6989586621679080786"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679080785"><span class="annot"><span class="annottext">SelectT r m a
</span><a href="#local-6989586621679080785"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="annot"><span class="annottext">(((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a)
-&gt; ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; m a
</span><a href="#local-6989586621679080786"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(m a -&gt; m a) -&gt; ((a -&gt; m r) -&gt; m a) -&gt; (a -&gt; m r) -&gt; m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">SelectT r m a -&gt; (a -&gt; m r) -&gt; m a
forall r (m :: * -&gt; *) a. SelectT r m a -&gt; (a -&gt; m r) -&gt; m a
</span><a href="Control.Monad.Trans.Select.html#runSelectT"><span class="hs-identifier hs-var">runSelectT</span></a></span><span> </span><span class="annot"><span class="annottext">SelectT r m a
</span><a href="#local-6989586621679080785"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-99"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#mapSelectT"><span class="hs-pragma hs-type">mapSelectT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span id="local-6989586621679080917"><span id="local-6989586621679080918"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679080782"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080918"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080917"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080918"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-102"></span><span>    </span><span id="local-6989586621679080779"><span class="annot"><span class="annottext">fmap :: forall a b. (a -&gt; b) -&gt; SelectT r m a -&gt; SelectT r m b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var hs-var hs-var hs-var">fmap</span></a></span></span><span> </span><span id="local-6989586621679080778"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080778"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080777"><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080777"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((b -&gt; m r) -&gt; m b) -&gt; SelectT r m b
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; m a -&gt; m b
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080778"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(m a -&gt; m b) -&gt; ((b -&gt; m r) -&gt; m a) -&gt; (b -&gt; m r) -&gt; m b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080777"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">((a -&gt; m r) -&gt; m a)
-&gt; ((b -&gt; m r) -&gt; a -&gt; m r) -&gt; (b -&gt; m r) -&gt; m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(b -&gt; m r) -&gt; (a -&gt; b) -&gt; a -&gt; m r
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080778"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-pragma hs-type">fmap</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span id="local-6989586621679080902"><span id="local-6989586621679080903"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679080768"><span id="local-6989586621679080771"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080903"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080903"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080902"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080903"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-106"></span><span>    </span><span id="local-6989586621679080762"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; SelectT r m a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; SelectT r m a
forall (t :: (* -&gt; *) -&gt; * -&gt; *) (m :: * -&gt; *) a.
(MonadTrans t, Monad m) =&gt;
m a -&gt; t m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var">lift</span></a></span><span> </span><span class="annot"><span class="annottext">(m a -&gt; SelectT r m a) -&gt; (a -&gt; m a) -&gt; a -&gt; SelectT r m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span>
</span><span id="line-107"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#pure"><span class="hs-pragma hs-type">pure</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-108"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080758"><span class="annot"><span class="annottext">((a -&gt; b) -&gt; m r) -&gt; m (a -&gt; b)
</span><a href="#local-6989586621679080758"><span class="hs-identifier hs-var">gf</span></a></span></span><span> </span><span id="local-6989586621679080757"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. SelectT r m (a -&gt; b) -&gt; SelectT r m a -&gt; SelectT r m b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;*&gt;</span></a></span></span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080756"><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080756"><span class="hs-identifier hs-var">gx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((b -&gt; m r) -&gt; m b) -&gt; SelectT r m b
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="annot"><span class="annottext">(((b -&gt; m r) -&gt; m b) -&gt; SelectT r m b)
-&gt; ((b -&gt; m r) -&gt; m b) -&gt; SelectT r m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679080755"><span class="annot"><span class="annottext">b -&gt; m r
</span><a href="#local-6989586621679080755"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-109"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679080753"><span class="annot"><span class="annottext">h :: (a -&gt; b) -&gt; m b
</span><a href="#local-6989586621679080753"><span class="hs-identifier hs-var hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679080752"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080752"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; m a -&gt; m b
forall (m :: * -&gt; *) a1 r. Monad m =&gt; (a1 -&gt; r) -&gt; m a1 -&gt; m r
</span><a href="../../base/src/GHC.Base.html#liftM"><span class="hs-identifier hs-var">liftM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080752"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080756"><span class="hs-identifier hs-var">gx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; m r
</span><a href="#local-6989586621679080755"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; m r) -&gt; (a -&gt; b) -&gt; a -&gt; m r
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080752"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span>        </span><span id="local-6989586621679080750"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080750"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((a -&gt; b) -&gt; m r) -&gt; m (a -&gt; b)
</span><a href="#local-6989586621679080758"><span class="hs-identifier hs-var">gf</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">m b -&gt; (b -&gt; m r) -&gt; m r
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; m r
</span><a href="#local-6989586621679080755"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(m b -&gt; m r) -&gt; ((a -&gt; b) -&gt; m b) -&gt; (a -&gt; b) -&gt; m r
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; m b
</span><a href="#local-6989586621679080753"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span>        </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; m b
</span><a href="#local-6989586621679080753"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679080750"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;*&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-113"></span><span>    </span><span id="local-6989586621679080748"><span class="annot"><span class="annottext">SelectT r m a
</span><a href="#local-6989586621679080748"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679080747"><span class="annot"><span class="annottext">*&gt; :: forall a b. SelectT r m a -&gt; SelectT r m b -&gt; SelectT r m b
</span><a href="../../base/src/GHC.Base.html#%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">*&gt;</span></a></span></span><span> </span><span id="local-6989586621679080746"><span class="annot"><span class="annottext">SelectT r m b
</span><a href="#local-6989586621679080746"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SelectT r m a
</span><a href="#local-6989586621679080748"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">SelectT r m a -&gt; (a -&gt; SelectT r m b) -&gt; SelectT r m b
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SelectT r m b
</span><a href="#local-6989586621679080746"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">*&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span id="local-6989586621679080876"><span id="local-6989586621679080877"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679080738"><span id="local-6989586621679080740"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080877"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080877"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Alternative"><span class="hs-identifier hs-type">Alternative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080876"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080877"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-117"></span><span>    </span><span id="local-6989586621679080734"><span class="annot"><span class="annottext">empty :: forall a. SelectT r m a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var hs-var hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SelectT r m a
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a
</span><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-identifier hs-var">mzero</span></a></span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-119"></span><span>    </span><span id="local-6989586621679080730"><span class="annot"><span class="annottext">&lt;|&gt; :: forall a. SelectT r m a -&gt; SelectT r m a -&gt; SelectT r m a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;|&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SelectT r m a -&gt; SelectT r m a -&gt; SelectT r m a
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-identifier hs-var">mplus</span></a></span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;|&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span id="local-6989586621679080885"><span id="local-6989586621679080886"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679080721"><span id="local-6989586621679080723"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080886"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080885"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080886"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,8,0))
</span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">lift</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">return</span><span>
</span><span id="line-125"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">return</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080717"><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080717"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679080716"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b. SelectT r m a -&gt; (a -&gt; SelectT r m b) -&gt; SelectT r m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">&gt;&gt;=</span></a></span></span><span> </span><span id="local-6989586621679080715"><span class="annot"><span class="annottext">a -&gt; SelectT r m b
</span><a href="#local-6989586621679080715"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((b -&gt; m r) -&gt; m b) -&gt; SelectT r m b
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="annot"><span class="annottext">(((b -&gt; m r) -&gt; m b) -&gt; SelectT r m b)
-&gt; ((b -&gt; m r) -&gt; m b) -&gt; SelectT r m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679080714"><span class="annot"><span class="annottext">b -&gt; m r
</span><a href="#local-6989586621679080714"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-128"></span><span>        </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679080713"><span class="annot"><span class="annottext">h :: a -&gt; m b
</span><a href="#local-6989586621679080713"><span class="hs-identifier hs-var hs-var">h</span></a></span></span><span> </span><span id="local-6989586621679080712"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679080712"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SelectT r m b -&gt; (b -&gt; m r) -&gt; m b
forall r (m :: * -&gt; *) a. SelectT r m a -&gt; (a -&gt; m r) -&gt; m a
</span><a href="Control.Monad.Trans.Select.html#runSelectT"><span class="hs-identifier hs-var">runSelectT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; SelectT r m b
</span><a href="#local-6989586621679080715"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679080712"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">b -&gt; m r
</span><a href="#local-6989586621679080714"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-129"></span><span>        </span><span id="local-6989586621679080711"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679080711"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080717"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">m b -&gt; (b -&gt; m r) -&gt; m r
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; m r
</span><a href="#local-6989586621679080714"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(m b -&gt; m r) -&gt; (a -&gt; m b) -&gt; a -&gt; m r
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621679080713"><span class="hs-identifier hs-var">h</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span>        </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621679080713"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679080711"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&gt;&gt;=</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span class="hs-cpp">

#if MIN_VERSION_base(4,9,0)
</span><span id="local-6989586621679080860"><span id="local-6989586621679080861"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080861"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080860"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080861"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-135"></span><span>    </span><span id="local-6989586621679080699"><span class="annot"><span class="annottext">fail :: forall a. String -&gt; SelectT r m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var hs-var hs-var hs-var">fail</span></a></span></span><span> </span><span id="local-6989586621679080698"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679080698"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; SelectT r m a
forall (t :: (* -&gt; *) -&gt; * -&gt; *) (m :: * -&gt; *) a.
(MonadTrans t, Monad m) =&gt;
m a -&gt; t m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var">lift</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; m a
forall (m :: * -&gt; *) a. MonadFail m =&gt; String -&gt; m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var">Fail.fail</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679080698"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-pragma hs-type">fail</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-139"></span><span id="local-6989586621679080874"><span id="local-6989586621679080875"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080875"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080874"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080875"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-140"></span><span>    </span><span id="local-6989586621679080682"><span class="annot"><span class="annottext">mzero :: forall a. SelectT r m a
</span><a href="#local-6989586621679080682"><span class="hs-identifier hs-var hs-var hs-var hs-var">mzero</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">m a -&gt; (a -&gt; m r) -&gt; m a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">m a
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a
</span><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-identifier hs-var">mzero</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-pragma hs-type">mzero</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-142"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080679"><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080679"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679080678"><span class="annot"><span class="annottext">mplus :: forall a. SelectT r m a -&gt; SelectT r m a -&gt; SelectT r m a
</span><a href="#local-6989586621679080678"><span class="hs-operator hs-var hs-var hs-var hs-var">`mplus`</span></a></span></span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080677"><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080677"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="annot"><span class="annottext">(((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a)
-&gt; ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679080676"><span class="annot"><span class="annottext">a -&gt; m r
</span><a href="#local-6989586621679080676"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080679"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m r
</span><a href="#local-6989586621679080676"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; m a -&gt; m a
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-operator hs-var">`mplus`</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080677"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m r
</span><a href="#local-6989586621679080676"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-143"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-pragma hs-type">mplus</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span id="local-6989586621679080900"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#MonadTrans"><span class="hs-identifier hs-type">MonadTrans</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080900"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-146"></span><span>    </span><span id="local-6989586621679080672"><span class="annot"><span class="annottext">lift :: forall (m :: * -&gt; *) a. Monad m =&gt; m a -&gt; SelectT r m a
</span><a href="#local-6989586621679080672"><span class="hs-identifier hs-var hs-var hs-var hs-var">lift</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
forall r (m :: * -&gt; *) a. ((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a
</span><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-var">SelectT</span></a></span><span> </span><span class="annot"><span class="annottext">(((a -&gt; m r) -&gt; m a) -&gt; SelectT r m a)
-&gt; (m a -&gt; (a -&gt; m r) -&gt; m a) -&gt; m a -&gt; SelectT r m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; (a -&gt; m r) -&gt; m a
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span>
</span><span id="line-147"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-pragma hs-type">lift</span></a></span><span> </span><span class="hs-pragma">#-}</span></span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span id="local-6989586621679080843"><span id="local-6989586621679080844"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080844"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080843"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080844"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-150"></span><span>    </span><span id="local-6989586621679080660"><span class="annot"><span class="annottext">liftIO :: forall a. IO a -&gt; SelectT r m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftIO</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; SelectT r m a
forall (t :: (* -&gt; *) -&gt; * -&gt; *) (m :: * -&gt; *) a.
(MonadTrans t, Monad m) =&gt;
m a -&gt; t m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var">lift</span></a></span><span> </span><span class="annot"><span class="annottext">(m a -&gt; SelectT r m a) -&gt; (IO a -&gt; m a) -&gt; IO a -&gt; SelectT r m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; m a
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span>
</span><span id="line-151"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-pragma hs-type">liftIO</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-comment">-- | Convert a selection computation to a continuation-passing computation.</span><span>
</span><span id="line-154"></span><span id="local-6989586621679080839"><span id="local-6989586621679080840"><span id="local-6989586621679080841"><span class="annot"><a href="Control.Monad.Trans.Select.html#selectToContT"><span class="hs-identifier hs-type">selectToContT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080841"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080840"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080841"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080839"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Cont.html#ContT"><span class="hs-identifier hs-type">ContT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080840"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080841"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080839"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-155"></span><span id="selectToContT"><span class="annot"><span class="annottext">selectToContT :: forall (m :: * -&gt; *) r a. Monad m =&gt; SelectT r m a -&gt; ContT r m a
</span><a href="Control.Monad.Trans.Select.html#selectToContT"><span class="hs-identifier hs-var hs-var">selectToContT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span id="local-6989586621679080656"><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080656"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((a -&gt; m r) -&gt; m r) -&gt; ContT r m a
forall {k} (r :: k) (m :: k -&gt; *) a.
((a -&gt; m r) -&gt; m r) -&gt; ContT r m a
</span><a href="Control.Monad.Trans.Cont.html#ContT"><span class="hs-identifier hs-var">ContT</span></a></span><span> </span><span class="annot"><span class="annottext">(((a -&gt; m r) -&gt; m r) -&gt; ContT r m a)
-&gt; ((a -&gt; m r) -&gt; m r) -&gt; ContT r m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679080654"><span class="annot"><span class="annottext">a -&gt; m r
</span><a href="#local-6989586621679080654"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m r) -&gt; m a
</span><a href="#local-6989586621679080656"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m r
</span><a href="#local-6989586621679080654"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">m a -&gt; (a -&gt; m r) -&gt; m r
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m r
</span><a href="#local-6989586621679080654"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-156"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#selectToCont"><span class="hs-pragma hs-type">selectToCont</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span class="hs-comment">-- | Deprecated name for 'selectToContT'.</span><span>
</span><span id="line-159"></span><span class="hs-pragma">{-# DEPRECATED</span><span> </span><span class="hs-pragma">selectToCont</span><span> </span><span class="hs-pragma">&quot;Use selectToContT instead&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-160"></span><span id="local-6989586621679080651"><span id="local-6989586621679080652"><span id="local-6989586621679080653"><span class="annot"><a href="Control.Monad.Trans.Select.html#selectToCont"><span class="hs-identifier hs-type">selectToCont</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080653"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Select.html#SelectT"><span class="hs-identifier hs-type">SelectT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080652"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080653"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080651"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Cont.html#ContT"><span class="hs-identifier hs-type">ContT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080652"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080653"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679080651"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-161"></span><span id="selectToCont"><span class="annot"><span class="annottext">selectToCont :: forall (m :: * -&gt; *) r a. Monad m =&gt; SelectT r m a -&gt; ContT r m a
</span><a href="Control.Monad.Trans.Select.html#selectToCont"><span class="hs-identifier hs-var hs-var">selectToCont</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SelectT r m a -&gt; ContT r m a
forall (m :: * -&gt; *) r a. Monad m =&gt; SelectT r m a -&gt; ContT r m a
</span><a href="Control.Monad.Trans.Select.html#selectToContT"><span class="hs-identifier hs-var">selectToContT</span></a></span><span>
</span><span id="line-162"></span></pre></body></html>